package com.itcat.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itcat.api.mysql.OmsOrderItemApi;
import com.itcat.mapper.OmsOrderItemMapper;
import com.itcat.mysql.pojo.OmsOrderItem;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class OmsOrderItemApiImpl implements OmsOrderItemApi {

    @Autowired
    private OmsOrderItemMapper omsOrderItemMapper;

    /**
     * 调用omsOrderItemApi查询订单商品详情
     *
     * @param id
     * @return
     */
    public List<OmsOrderItem> findItem(Integer id) {
        //构建查询条件
        LambdaQueryWrapper<OmsOrderItem> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(id != null, OmsOrderItem::getOrderId, id);
        List<OmsOrderItem> itemList = omsOrderItemMapper.selectList(queryWrapper);
        return itemList;
    }
}
